package com.surfilter.modules.module.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.surfilter.modules.module.model.ActionModel;
import com.surfilter.platform.base.dao.DaoBase;

@Repository
public class ActionDao extends DaoBase<ActionModel> {

	@Resource(name = "surfilterSqlMapClient")
	private SqlMapClient sqlMapClient;
	
	public int addAction(ActionModel actionModel) {
		Integer key = (Integer) this.addObject("addAction", actionModel);
		return key;
	}

	public List<ActionModel> getActionsOfModule(int id) {
		return this.getObjectsByObject("getActionsOfModule", id);
	}
	
	public List<ActionModel> getAllActions() {
		return this.getObjectsByObject("getAllActions",null);
	}
	
	public int chgAction(ActionModel actionModel){
		return this.updateObject("chgAction", actionModel);
	}
	
	public int delActions(List<Integer> actionIds){
		return this.deleteObject("delActions", actionIds);
	}

	public void initSqlMapClient() {
		this.setSqlMapClient(sqlMapClient);
	}

}
